package practice;

import java.util.Scanner;

public class _构建短字符串_ {
    public static void main(String[] args) {
        _构建短字符串_ c = new _构建短字符串_();
        _构建短字符串_.Solution s = c.getSolutin();
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        String[] inputarr = input.split(" ");
        System.out.println(s.built(inputarr[0], inputarr[1]));
    }

    Solution getSolutin() {
        return new Solution();
    }

    class Solution {
        public boolean built(String str1, String str2) {
            int[] index = new int[str2.length()];
            for (int i = 0; i < str1.length(); i++) {
                System.out.println(str1.charAt(i));
                if (in(str1.charAt(i), str2, index) != 1) return false;
            }
            return true;
        }

        private int in(char s, String arr, int[] index) {
            for (int j = 0; j < arr.length(); j++) {
                if (arr.charAt(j) == s && index[j] == 0) {
                    index[j] = 1;
                    return 1;
                }
            }
            return 0;
        }
    }
}
